<?php
import('ORG.Util.Function');

class DownloadAction extends CommonAction {
	
	public function _initialize(){
		parent::_initialize();
		$this->assign('li_selected','download');
		//titile,keyword,
		$this->assign("global_title",		"APP下载_音伴尔官网");
	}
	
	public function _empty(){
		$this->app();
	}
	
	public function mobile(){
		
		$this->display('app');
	}
	
	public function ipad(){		
		$this->display('app');
	}
	
    public function app(){		
    	$this->display('app');
    }
    
    public function sendappurl(){
    	// 导入短信类
    	import('@.Org.Message');
    	
    	$phone		=	$_POST['tel'];
    	if(empty($phone)){
    		$this->ajaxReturn(1,'手机号码不能为空',1);
    	}
    	if(strlen($phone) != 11){
    		$this->ajaxReturn(1,'手机号码格式不正确',1);
    	}    	
    	// 匹配是否为手机号码
    	$reg		=	'/^(1(([35][0-9])|(47)|[8][0126789]))\d{8}$/';
    	preg_match_all($reg, $phone, $m);
    	
    	if(empty($m[0][0])){
    		$this->ajaxReturn(1,'手机号码格式不正确',1);
    	}
    	// 发送APP连接
    	$url		=	'http://www.yinbaner.com/Public/upload/yinbaner.apk';
    	
    	$status		=	Message::sendAppUrl($phone, $url);
    	if($status){
    		$this->ajaxReturn(1,"  手机app已发送到你手机，请注意查收   ",1);	
    	}
    	else{
    		$this->ajaxReturn(1,"  发送失败，请重新点击发送   ",1);
    	}	
    }
}